package DecoratorPattern;

import Model.Book;

// 损坏罚款装饰器
public class DamagedFineDecorator extends FineDecorator {
    private final double damagedFine;


    public DamagedFineDecorator(Book book, double damagedFine) {
        super(book);
        this.damagedFine = damagedFine;
    }

    @Override
    public double calculateFine() {
        // 基本罚款 + 损坏罚款
        return book.calculateFine() + damagedFine;
    }

    @Override
    public void displayInfo() {
        // 显示基本信息
        book.displayInfo();
        // 显示逾期罚款信息
        System.out.println("Damaged Fine: $" + damagedFine);
        // 显示总罚款信息
        System.out.println("Total Fine: $" + calculateFine());
    }
}

